package cn.com.dhc.danlu.activity;

import android.annotation.SuppressLint;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;

import com.umeng.analytics.MobclickAgent;

import cn.com.dhc.danlu.R;

/**
 * @author wuhaiyang
 */
@SuppressLint("Registered")
@Deprecated
public class DefaultFragmentActivity extends FragmentActivity {
    @Override
    public void setContentView(int layoutResID) {
        super.setContentView(layoutResID);
        setCommonViewAttr();
    }

    @Override
    public void setContentView(View view) {
        super.setContentView(view);
        setCommonViewAttr();
    }

    @Override
    public void setContentView(View view, LayoutParams params) {
        super.setContentView(view, params);
        setCommonViewAttr();
    }

    private void setCommonViewAttr() {
        findViewById(R.id.iv_back).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                backPressed();
            }
        });
    }

    @Override
    protected void onPause() {
        MobclickAgent.onPause(this);//session的统计
        super.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        MobclickAgent.onResume(this);//session的统计
    }

    /**
     * 左上角 返回键按下的触发事件
     */
    protected void backPressed() {
        finish();
    }
}